package com.day16.Map2;
import java.util.Map;

import java.util.HashMap;
import java.util.Set;

public class HashMapDemo1 {
    public static void main(String[] args)
    {
        HashMap<String,Student> hm=new HashMap<String,Student>();
        Student s1=new Student("林青霞",30);
        Student s2=new Student("张曼玉",35);
        Student s3=new Student("王祖贤",33);
        hm.put("itheima001",s1);
        hm.put("itheima002",s2);
        hm.put("itheima003",s3);
        Set<String> keySet=hm.keySet();
        for(String key:keySet){
            Student value=hm.get(key);
            System.out.println(key+","+value.getName()+","+value.getAge());

        }
        System.out.println("----------");
        Set<Map.Entry<String,Student>> entrySet=hm.entrySet();
        for(Map.Entry<String,Student> entry:entrySet){
            String key=entry.getKey();
            Student value=entry.getValue();
            System.out.println(key+","+value.getName()+","+value.getAge());
        }

    }
}
